\(\int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx\) [564]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 157 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {3 a b^2 \text {arctanh}\left (\frac {b-a \tan (c+d x)}{\sqrt {a^2+b^2} \sqrt {\sec ^2(c+d x)}}\right ) \cos (c+d x) \sqrt {\sec ^2(c+d x)}}{\left (a^2+b^2\right )^{5/2} d}+\frac {b \left (a^2-2 b^2\right ) \sec (c+d x)}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\cos (c+d x) (b+a \tan (c+d x))}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))} \]

[Out]

-3*a*b^2*arctanh((b-a*tan(d*x+c))/(a^2+b^2)^(1/2)/(sec(d*x+c)^2)^(1/2))*cos(d*x+c)*(sec(d*x+c)^2)^(1/2)/(a^2+b
^2)^(5/2)/d+b*(a^2-2*b^2)*sec(d*x+c)/(a^2+b^2)^2/d/(a+b*tan(d*x+c))+cos(d*x+c)*(b+a*tan(d*x+c))/(a^2+b^2)/d/(a
+b*tan(d*x+c))

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 157, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3593, 755, 821, 739, 212} \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {3 a b^2 \cos (c+d x) \sqrt {\sec ^2(c+d x)} \text {arctanh}\left (\frac {b-a \tan (c+d x)}{\sqrt {a^2+b^2} \sqrt {\sec ^2(c+d x)}}\right )}{d \left (a^2+b^2\right )^{5/2}}+\frac {\cos (c+d x) (a \tan (c+d x)+b)}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}+\frac {b \left (a^2-2 b^2\right ) \sec (c+d x)}{d \left (a^2+b^2\right )^2 (a+b \tan (c+d x))} \]

[In]

Int[Cos[c + d*x]/(a + b*Tan[c + d*x])^2,x]

[Out]

(-3*a*b^2*ArcTanh[(b - a*Tan[c + d*x])/(Sqrt[a^2 + b^2]*Sqrt[Sec[c + d*x]^2])]*Cos[c + d*x]*Sqrt[Sec[c + d*x]^
2])/((a^2 + b^2)^(5/2)*d) + (b*(a^2 - 2*b^2)*Sec[c + d*x])/((a^2 + b^2)^2*d*(a + b*Tan[c + d*x])) + (Cos[c + d
*x]*(b + a*Tan[c + d*x]))/((a^2 + b^2)*d*(a + b*Tan[c + d*x]))

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 739

Int[1/(((d_) + (e_.)*(x_))*Sqrt[(a_) + (c_.)*(x_)^2]), x_Symbol] :> -Subst[Int[1/(c*d^2 + a*e^2 - x^2), x], x,
 (a*e - c*d*x)/Sqrt[a + c*x^2]] /; FreeQ[{a, c, d, e}, x]

Rule 755

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(-(d + e*x)^(m + 1))*(a*e + c*d*x)*
((a + c*x^2)^(p + 1)/(2*a*(p + 1)*(c*d^2 + a*e^2))), x] + Dist[1/(2*a*(p + 1)*(c*d^2 + a*e^2)), Int[(d + e*x)^
m*Simp[c*d^2*(2*p + 3) + a*e^2*(m + 2*p + 3) + c*e*d*(m + 2*p + 4)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[
{a, c, d, e, m}, x] && NeQ[c*d^2 + a*e^2, 0] && LtQ[p, -1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 821

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Simp[(-(e*f - d*g
))*(d + e*x)^(m + 1)*((a + c*x^2)^(p + 1)/(2*(p + 1)*(c*d^2 + a*e^2))), x] + Dist[(c*d*f + a*e*g)/(c*d^2 + a*e
^2), Int[(d + e*x)^(m + 1)*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g, m, p}, x] && NeQ[c*d^2 + a*e^2, 0
] && EqQ[Simplify[m + 2*p + 3], 0]

Rule 3593

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[d^(2*
IntPart[m/2])*((d*Sec[e + f*x])^(2*FracPart[m/2])/(b*f*(Sec[e + f*x]^2)^FracPart[m/2])), Subst[Int[(a + x)^n*(
1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && NeQ[a^2 + b^2, 0] &&
 !IntegerQ[m/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\left (\cos (c+d x) \sqrt {\sec ^2(c+d x)}\right ) \text {Subst}\left (\int \frac {1}{(a+x)^2 \left (1+\frac {x^2}{b^2}\right )^{3/2}} \, dx,x,b \tan (c+d x)\right )}{b d} \\ & = \frac {\cos (c+d x) (b+a \tan (c+d x))}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}-\frac {\left (b \cos (c+d x) \sqrt {\sec ^2(c+d x)}\right ) \text {Subst}\left (\int \frac {-2-\frac {a x}{b^2}}{(a+x)^2 \sqrt {1+\frac {x^2}{b^2}}} \, dx,x,b \tan (c+d x)\right )}{\left (a^2+b^2\right ) d} \\ & = \frac {b \left (a^2-2 b^2\right ) \sec (c+d x)}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\cos (c+d x) (b+a \tan (c+d x))}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {\left (3 a b \cos (c+d x) \sqrt {\sec ^2(c+d x)}\right ) \text {Subst}\left (\int \frac {1}{(a+x) \sqrt {1+\frac {x^2}{b^2}}} \, dx,x,b \tan (c+d x)\right )}{\left (a^2+b^2\right )^2 d} \\ & = \frac {b \left (a^2-2 b^2\right ) \sec (c+d x)}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\cos (c+d x) (b+a \tan (c+d x))}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))}-\frac {\left (3 a b \cos (c+d x) \sqrt {\sec ^2(c+d x)}\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a^2}{b^2}-x^2} \, dx,x,\frac {1-\frac {a \tan (c+d x)}{b}}{\sqrt {\sec ^2(c+d x)}}\right )}{\left (a^2+b^2\right )^2 d} \\ & = -\frac {3 a b^2 \text {arctanh}\left (\frac {b \left (1-\frac {a \tan (c+d x)}{b}\right )}{\sqrt {a^2+b^2} \sqrt {\sec ^2(c+d x)}}\right ) \cos (c+d x) \sqrt {\sec ^2(c+d x)}}{\left (a^2+b^2\right )^{5/2} d}+\frac {b \left (a^2-2 b^2\right ) \sec (c+d x)}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\cos (c+d x) (b+a \tan (c+d x))}{\left (a^2+b^2\right ) d (a+b \tan (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.94 (sec) , antiderivative size = 153, normalized size of antiderivative = 0.97 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {\sec (c+d x) \left (12 a b^2 \sqrt {a^2+b^2} \text {arctanh}\left (\frac {-b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2+b^2}}\right ) (a \cos (c+d x)+b \sin (c+d x))+\left (a^2+b^2\right ) \left (3 b \left (a^2-b^2\right )+b \left (a^2+b^2\right ) \cos (2 (c+d x))+a \left (a^2+b^2\right ) \sin (2 (c+d x))\right )\right )}{2 \left (a^2+b^2\right )^3 d (a+b \tan (c+d x))} \]

[In]

Integrate[Cos[c + d*x]/(a + b*Tan[c + d*x])^2,x]

[Out]

(Sec[c + d*x]*(12*a*b^2*Sqrt[a^2 + b^2]*ArcTanh[(-b + a*Tan[(c + d*x)/2])/Sqrt[a^2 + b^2]]*(a*Cos[c + d*x] + b
*Sin[c + d*x]) + (a^2 + b^2)*(3*b*(a^2 - b^2) + b*(a^2 + b^2)*Cos[2*(c + d*x)] + a*(a^2 + b^2)*Sin[2*(c + d*x)
])))/(2*(a^2 + b^2)^3*d*(a + b*Tan[c + d*x]))

Maple [A] (verified)

Time = 2.32 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.10

method result size
derivativedivides \(\frac {-\frac {2 \left (\left (-a^{2}+b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 a b \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {2 b^{2} \left (\frac {-\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}-b}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-a}-\frac {3 a \,\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) \(172\)
default \(\frac {-\frac {2 \left (\left (-a^{2}+b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 a b \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {2 b^{2} \left (\frac {-\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}-b}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-a}-\frac {3 a \,\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) \(172\)
risch \(-\frac {i {\mathrm e}^{i \left (d x +c \right )}}{2 \left (-2 i a b +a^{2}-b^{2}\right ) d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{2 \left (2 i a b +a^{2}-b^{2}\right ) d}-\frac {2 i b^{3} {\mathrm e}^{i \left (d x +c \right )}}{\left (-i a +b \right )^{2} d \left (i a +b \right )^{2} \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a \,{\mathrm e}^{2 i \left (d x +c \right )}-b +i a \right )}+\frac {3 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}} d}-\frac {3 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}} d}\) \(295\)

[In]

int(cos(d*x+c)/(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(-2/(a^4+2*a^2*b^2+b^4)*((-a^2+b^2)*tan(1/2*d*x+1/2*c)-2*a*b)/(1+tan(1/2*d*x+1/2*c)^2)-2*b^2/(a^2+b^2)^2*(
(-b^2/a*tan(1/2*d*x+1/2*c)-b)/(tan(1/2*d*x+1/2*c)^2*a-2*b*tan(1/2*d*x+1/2*c)-a)-3*a/(a^2+b^2)^(1/2)*arctanh(1/
2*(2*a*tan(1/2*d*x+1/2*c)-2*b)/(a^2+b^2)^(1/2))))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 302, normalized size of antiderivative = 1.92 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {2 \, a^{4} b - 2 \, a^{2} b^{3} - 4 \, b^{5} + 2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + 3 \, {\left (a^{2} b^{2} \cos \left (d x + c\right ) + a b^{3} \sin \left (d x + c\right )\right )} \sqrt {a^{2} + b^{2}} \log \left (-\frac {2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right )}{2 \, {\left ({\left (a^{7} + 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} + a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}\right )} d \sin \left (d x + c\right )\right )}} \]

[In]

integrate(cos(d*x+c)/(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*(2*a^4*b - 2*a^2*b^3 - 4*b^5 + 2*(a^4*b + 2*a^2*b^3 + b^5)*cos(d*x + c)^2 + 2*(a^5 + 2*a^3*b^2 + a*b^4)*co
s(d*x + c)*sin(d*x + c) + 3*(a^2*b^2*cos(d*x + c) + a*b^3*sin(d*x + c))*sqrt(a^2 + b^2)*log(-(2*a*b*cos(d*x +
c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 - 2*a^2 - b^2 + 2*sqrt(a^2 + b^2)*(b*cos(d*x + c) - a*sin(d*x + c
)))/(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 + b^2)))/((a^7 + 3*a^5*b^2 + 3*a^3*b^4 + a*b
^6)*d*cos(d*x + c) + (a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7)*d*sin(d*x + c))

Sympy [F]

\[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=\int \frac {\cos {\left (c + d x \right )}}{\left (a + b \tan {\left (c + d x \right )}\right )^{2}}\, dx \]

[In]

integrate(cos(d*x+c)/(a+b*tan(d*x+c))**2,x)

[Out]

Integral(cos(c + d*x)/(a + b*tan(c + d*x))**2, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 348 vs. \(2 (151) = 302\).

Time = 0.42 (sec) , antiderivative size = 348, normalized size of antiderivative = 2.22 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {3 \, a b^{2} \log \left (\frac {b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {a^{2} + b^{2}}} - \frac {2 \, {\left (2 \, a^{3} b - a b^{3} - \frac {3 \, a b^{3} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {{\left (a^{4} + 3 \, a^{2} b^{2} - b^{4}\right )} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {{\left (a^{4} - a^{2} b^{2} + b^{4}\right )} \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + \frac {2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} - \frac {{\left (a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}}}{d} \]

[In]

integrate(cos(d*x+c)/(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

-(3*a*b^2*log((b - a*sin(d*x + c)/(cos(d*x + c) + 1) + sqrt(a^2 + b^2))/(b - a*sin(d*x + c)/(cos(d*x + c) + 1)
 - sqrt(a^2 + b^2)))/((a^4 + 2*a^2*b^2 + b^4)*sqrt(a^2 + b^2)) - 2*(2*a^3*b - a*b^3 - 3*a*b^3*sin(d*x + c)^2/(
cos(d*x + c) + 1)^2 + (a^4 + 3*a^2*b^2 - b^4)*sin(d*x + c)/(cos(d*x + c) + 1) - (a^4 - a^2*b^2 + b^4)*sin(d*x
+ c)^3/(cos(d*x + c) + 1)^3)/(a^6 + 2*a^4*b^2 + a^2*b^4 + 2*(a^5*b + 2*a^3*b^3 + a*b^5)*sin(d*x + c)/(cos(d*x
+ c) + 1) + 2*(a^5*b + 2*a^3*b^3 + a*b^5)*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 - (a^6 + 2*a^4*b^2 + a^2*b^4)*si
n(d*x + c)^4/(cos(d*x + c) + 1)^4))/d

Giac [A] (verification not implemented)

none

Time = 0.51 (sec) , antiderivative size = 286, normalized size of antiderivative = 1.82 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {3 \, a b^{2} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {a^{2} + b^{2}}} - \frac {2 \, {\left (a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, a^{3} b + a b^{3}\right )}}{{\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a\right )}}}{d} \]

[In]

integrate(cos(d*x+c)/(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-(3*a*b^2*log(abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b - 2*sqrt(a^2 + b^2))/abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b + 2*s
qrt(a^2 + b^2)))/((a^4 + 2*a^2*b^2 + b^4)*sqrt(a^2 + b^2)) - 2*(a^4*tan(1/2*d*x + 1/2*c)^3 - a^2*b^2*tan(1/2*d
*x + 1/2*c)^3 + b^4*tan(1/2*d*x + 1/2*c)^3 + 3*a*b^3*tan(1/2*d*x + 1/2*c)^2 - a^4*tan(1/2*d*x + 1/2*c) - 3*a^2
*b^2*tan(1/2*d*x + 1/2*c) + b^4*tan(1/2*d*x + 1/2*c) - 2*a^3*b + a*b^3)/((a^5 + 2*a^3*b^2 + a*b^4)*(a*tan(1/2*
d*x + 1/2*c)^4 - 2*b*tan(1/2*d*x + 1/2*c)^3 - 2*b*tan(1/2*d*x + 1/2*c) - a)))/d

Mupad [B] (verification not implemented)

Time = 6.54 (sec) , antiderivative size = 286, normalized size of antiderivative = 1.82 \[ \int \frac {\cos (c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {\frac {4\,a^2\,b-2\,b^3}{a^4+2\,a^2\,b^2+b^4}-\frac {6\,b^3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{a^4+2\,a^2\,b^2+b^4}+\frac {2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^4+3\,a^2\,b^2-b^4\right )}{a\,\left (a^4+2\,a^2\,b^2+b^4\right )}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (2\,a^4-2\,a^2\,b^2+2\,b^4\right )}{a\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{d\,\left (-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+a\right )}-\frac {6\,a\,b^2\,\mathrm {atanh}\left (\frac {a^4\,b+b^5+2\,a^2\,b^3-a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^4+2\,a^2\,b^2+b^4\right )}{{\left (a^2+b^2\right )}^{5/2}}\right )}{d\,{\left (a^2+b^2\right )}^{5/2}} \]

[In]

int(cos(c + d*x)/(a + b*tan(c + d*x))^2,x)

[Out]

((4*a^2*b - 2*b^3)/(a^4 + b^4 + 2*a^2*b^2) - (6*b^3*tan(c/2 + (d*x)/2)^2)/(a^4 + b^4 + 2*a^2*b^2) + (2*tan(c/2
 + (d*x)/2)*(a^4 - b^4 + 3*a^2*b^2))/(a*(a^4 + b^4 + 2*a^2*b^2)) - (tan(c/2 + (d*x)/2)^3*(2*a^4 + 2*b^4 - 2*a^
2*b^2))/(a*(a^4 + b^4 + 2*a^2*b^2)))/(d*(a + 2*b*tan(c/2 + (d*x)/2) - a*tan(c/2 + (d*x)/2)^4 + 2*b*tan(c/2 + (
d*x)/2)^3)) - (6*a*b^2*atanh((a^4*b + b^5 + 2*a^2*b^3 - a*tan(c/2 + (d*x)/2)*(a^4 + b^4 + 2*a^2*b^2))/(a^2 + b
^2)^(5/2)))/(d*(a^2 + b^2)^(5/2))